#include<iostream>
#include<queue>
#include<stack>
using namespace std;
stack<int> q_Zer;
queue<int> q;
void find_top(int graph[][200], int visit[], int n)
{
	int sum = 0;
	int i = 0;
	for (i; i < n; i++)
	{
		int j = 0;
		int flag = 1;
		for (j; j < n; j++)
		{
			if (graph[j][i] != 0 || visit[i] != 0)
			{
				flag = 0;
				break;
			}
		}
		if (flag)
		{
			sum++;
			q_Zer.push(i);
			visit[i] = 1;
		}
	}
}
void TopoSort(int graph[200][200], int visit[], int n)
{
	find_top(graph, visit, n);
	while (!q_Zer.empty())
	{
		int cur = q_Zer.top();
		q.push(q_Zer.top());
		q_Zer.pop();
		int i = 0;
		for (i; i < n; i++)
		{
			if (graph[cur][i] == 1)
			{
				graph[cur][i] = 0;
			}
		}
		find_top(graph, visit,n);
	}
	
}
int main()
{
	int graph[200][200] = { 0 };
	int visit[200] = { 0 };
	int n;
	cin >> n;
	int i = 0;
	for (i; i < n; i++)
	{
		int j = 0;
		for (j; j < n; j++)
		{
			cin >> graph[i][j];
		}
	}
	TopoSort(graph,visit, n);
	while (!q.empty())
	{
		cout << q.front() << ' ';
		q.pop();
	}
}